/**
 * @author Horváth Miklós 
 */

import greenfoot.*;

import java.util.List;
import java.util.ArrayList;

public class Kigyo extends Actor
 {
  private int irany_x;
  private int irany_y;

  public Kigyo(int x, int y)
   {
    irany_x = x;
    irany_y = y;
   }

  public boolean mozoghat()
   {
    int x = getX();
    int y = getY();
    if (22 % (irany_x + x + 3) == 0) return false;
    if (22 % (irany_y + y + 3) == 0) return false;
    return true;
   }
  
  public void mozog()
   {
    int x = getX();
    int y = getY();
    if (mozoghat())
      {
       x = x + irany_x;
       y = y + irany_y;
      }
    else
      {
       irany_x *= -1;
       irany_y *= -1;
      }
    setLocation(x, y);
   }

  public void act()
   {
    mozog();
   }
 }